package com.pkcargo.service.cargo;

import com.pkcargo.entity.cargo.Cargo;
import org.springside.modules.orm.hibernate.DefaultEntityManager;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.hibernate.Session;

/**
 * Created by IntelliJ IDEA.
 * User: Howard
 * Date: 2009-4-19
 * Time: 22:16:10
 * To change this template use File | Settings | File Templates.
 */
@Service
@Transactional
public class CargoManager extends DefaultEntityManager<Cargo, Long> {
    //Deprecate 在Hibernate已经设置好1one1关系及配置以后，会自动添加子对象
    public void saveAll(Cargo cargo) {
        Session session = getEntityDao().getSession();
        session.save(cargo.getMetadata());
        session.saveOrUpdate(cargo);
	}
}
